package com.ty.day4;

import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 * Author : txy
 * Create 2023/10/31 10:09
 */
public class Two {
    public static void main(String[] args) {
        int a, x;
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个整数：");
        a = sc.nextInt();
        if (a % 2 == 1) {
            x = a / 2 + 1;
        } else {
            x = a / 2;
        }
        for (int i = 1; i <= x; i++) {
            space(x, i);
        }
        for (int i = a - x; i > 0; i--) {
            space(x, i);
        }
    }

    private static void space(int x, int i) {
        for (int j = 0; j < x - i; j++) {
            System.out.print(" ");
        }
        for (int j = 0; j < 2 * i - 1; j++) {
            System.out.print("*");
        }
        System.out.println();
    }
}
